﻿using Hehq.Core.Apps.Attributes;
using Hehq.Core.AppsImpl.Attributes;
using Microsoft.AspNetCore.Mvc;
using System;
using System.IO;
using System.Reflection;


namespace Hehq.Tenant.WebApi
{
    /// <summary>
    /// 模块信息
    /// </summary>
    [DynamicWebApi]
    [AllowAnonymous]
    public class ModuleInfo2 : Hehq.Apps.IDynamic
    {
        /// <summary>
        /// 获取版本号
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetVersion2()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            var dt = (new FileInfo(assembly.Location)).LastWriteTime;
            return $"tenant_V1.1.{dt.ToString("yyyy.MM.dd HH.mm.ss")}";
        }

        /// <summary>
        /// 获取模块描述信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ModuleVo GetDesc2()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            var dt = (new FileInfo(assembly.Location)).LastWriteTime;
            return new ModuleVo()
            {
                Version = this.GetVersion2(),
                Desc = "租户管理",
                CreateTime = dt
            };
        }
    }
    /// <summary>
    /// 模块Vo
    /// </summary>
    public class ModuleVo
    {
        /// <summary>
        /// 版本
        /// </summary>
        public string Version { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        public string Desc { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public DateTime CreateTime { get; set; }

    }
}
